package com.ygp.dtp.core.context;

import com.alibaba.ttl.TransmittableThreadLocal;

/**
 * @description: 动态线程池上下文持有者
 * @motto: 代码源于生活，高于生活艺术
 * @author: zhouhengzhe
 * @date: 2022/8/8 14:03
 * @since 1.0
 **/
public class DynamicThreadPoolContextHolder {

    private static final TransmittableThreadLocal<DynamicThreadPoolContext> CONTEXT = new TransmittableThreadLocal<>();

    public static DynamicThreadPoolContext get() {
        return CONTEXT.get();
    }

    public static void set(DynamicThreadPoolContext dynamicThreadPoolContext) {
        CONTEXT.set(dynamicThreadPoolContext);
    }

    public static void remove() {
        CONTEXT.remove();
    }
}
